using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Iacym.Entities;

namespace Iacym.Repository.Mapping
{
    public class DATOS_TRANSFERENCIAMap : EntityTypeConfiguration<DATOS_TRANSFERENCIA>
    {
        public DATOS_TRANSFERENCIAMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("DATOS_TRANSFERENCIA");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.PersonaId).HasColumnName("PersonaId");
            this.Property(t => t.CargoIglesiaId).HasColumnName("CargoIglesiaId");

            // Relationships
            this.HasRequired(t => t.CARGO_IGLESIA)
                .WithMany(t => t.DATOS_TRANSFERENCIA)
                .HasForeignKey(d => d.CargoIglesiaId);
            this.HasRequired(t => t.PERSONA)
                .WithMany(t => t.DATOS_TRANSFERENCIA)
                .HasForeignKey(d => d.PersonaId);

        }
    }
}
